@hraness/kb 0.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (200) hide show
  1. package/DISCLOSURE +43 -0
  2. package/LICENSE +21 -0
  3. package/README.md +545 -0
  4. package/dist/agent-context.js +35 -0
  5. package/dist/agent-guide-audit.js +18 -0
  6. package/dist/attachments.js +19 -0
  7. package/dist/authoring.js +33 -0
  8. package/dist/benchmark.js +19 -0
  9. package/dist/capture.js +49 -0
  10. package/dist/cli.js +3646 -0
  11. package/dist/clip/acquire.js +57 -0
  12. package/dist/clip/args.js +21 -0
  13. package/dist/clip/bounded-byte-buffer.js +9 -0
  14. package/dist/clip/browser-profiles.js +17 -0
  15. package/dist/clip/bundle-reader.js +11 -0
  16. package/dist/clip/cli.js +27 -0
  17. package/dist/clip/cookies.js +21 -0
  18. package/dist/clip/defuddle-worker.js +84 -0
  19. package/dist/clip/doctor.js +32 -0
  20. package/dist/clip/jobs.js +784 -0
  21. package/dist/clip/network-proxy.js +9 -0
  22. package/dist/clip/network.js +28 -0
  23. package/dist/clip/persist.js +30 -0
  24. package/dist/clip/refresh.js +11 -0
  25. package/dist/clip/terminal.js +11 -0
  26. package/dist/evaluation-builder.js +12238 -0
  27. package/dist/evaluation-kb.js +26 -0
  28. package/dist/evaluation.js +35 -0
  29. package/dist/git.js +39 -0
  30. package/dist/graph.js +39 -0
  31. package/dist/index-01jj6rbv.js +1103 -0
  32. package/dist/index-06c9ctr6.js +738 -0
  33. package/dist/index-0kavxzqj.js +2480 -0
  34. package/dist/index-1gwbassd.js +743 -0
  35. package/dist/index-1n418kb9.js +827 -0
  36. package/dist/index-1vrd1rmn.js +56 -0
  37. package/dist/index-1xxnjn0d.js +171 -0
  38. package/dist/index-3rm7cz6h.js +373 -0
  39. package/dist/index-3v2z4f0q.js +328 -0
  40. package/dist/index-48pz4jpc.js +392 -0
  41. package/dist/index-4j3tt0c3.js +234 -0
  42. package/dist/index-5n05se68.js +307 -0
  43. package/dist/index-5vwpzb5a.js +764 -0
  44. package/dist/index-6g2pv9d2.js +370 -0
  45. package/dist/index-7fzc32gf.js +712 -0
  46. package/dist/index-84x0vjjp.js +432 -0
  47. package/dist/index-adx6khj5.js +488 -0
  48. package/dist/index-b88v3vtm.js +805 -0
  49. package/dist/index-cv6fh7z5.js +462 -0
  50. package/dist/index-cxfrakt7.js +1067 -0
  51. package/dist/index-d13v9ckt.js +150 -0
  52. package/dist/index-dycjbhw2.js +1943 -0
  53. package/dist/index-dyqwejk5.js +531 -0
  54. package/dist/index-e5fbsywq.js +658 -0
  55. package/dist/index-f984hw45.js +927 -0
  56. package/dist/index-gh719d91.js +63 -0
  57. package/dist/index-hgve9rh2.js +2046 -0
  58. package/dist/index-hya40gb2.js +474 -0
  59. package/dist/index-j4zgmzjr.js +152 -0
  60. package/dist/index-jsmvyyvf.js +1166 -0
  61. package/dist/index-kh0pwvdd.js +1974 -0
  62. package/dist/index-mqx4nd6v.js +119 -0
  63. package/dist/index-mxxxytys.js +1254 -0
  64. package/dist/index-n5dd7r0v.js +711 -0
  65. package/dist/index-npg9z1a4.js +431 -0
  66. package/dist/index-pj501bh1.js +140 -0
  67. package/dist/index-qry4vhxk.js +1041 -0
  68. package/dist/index-s2gw5aw9.js +199 -0
  69. package/dist/index-vvdj6kca.js +70 -0
  70. package/dist/index-w2zc0vwa.js +571 -0
  71. package/dist/index-x3fthpsc.js +585 -0
  72. package/dist/index-zr53sf63.js +44 -0
  73. package/dist/index-zxdy5pby.js +2728 -0
  74. package/dist/index-zzhgcwyt.js +966 -0
  75. package/dist/index.js +453 -0
  76. package/dist/navigation.js +13 -0
  77. package/dist/pdf.js +85 -0
  78. package/dist/percolate.js +24 -0
  79. package/dist/portfolio.js +77 -0
  80. package/dist/query.js +29 -0
  81. package/dist/repository-memory.js +60 -0
  82. package/dist/sdk.js +36 -0
  83. package/dist/search-rules.js +34 -0
  84. package/dist/search.js +22 -0
  85. package/dist/semantic.js +39 -0
  86. package/dist/source-inbox.js +17 -0
  87. package/dist/untrusted-content.js +32 -0
  88. package/dist/url-intelligence.js +74 -0
  89. package/dist/workflow.js +23 -0
  90. package/dist/workflows/decision-context.js +20 -0
  91. package/dist/workflows/explain-change.js +8 -0
  92. package/dist/workflows/index.js +28 -0
  93. package/dist/workflows/plan-radar.js +10 -0
  94. package/package.json +409 -0
  95. package/skills/kb/AGENTS.md +19 -0
  96. package/skills/kb/SKILL.md +82 -0
  97. package/skills/kb/agents/openai.yaml +4 -0
  98. package/skills/kb/references/pdf-review.md +51 -0
  99. package/skills/kb/references/percolate.md +144 -0
  100. package/skills/kb/references/plan-structure.md +105 -0
  101. package/skills/kb/references/plan.md +115 -0
  102. package/skills/kb/references/query.md +231 -0
  103. package/skills/kb/references/refresh.md +133 -0
  104. package/skills/kb/references/save-pdf.md +125 -0
  105. package/skills/kb/references/save-url.md +178 -0
  106. package/skills/kb/references/url-authentication.md +75 -0
  107. package/skills/kb/references/url-platforms.md +25 -0
  108. package/src/agent-context.ts +1241 -0
  109. package/src/agent-guide-audit.ts +750 -0
  110. package/src/attachments.ts +723 -0
  111. package/src/authoring.ts +1725 -0
  112. package/src/benchmark.ts +362 -0
  113. package/src/capture.ts +68 -0
  114. package/src/cli.ts +3660 -0
  115. package/src/clip/acquire.ts +1273 -0
  116. package/src/clip/archive-today.ts +402 -0
  117. package/src/clip/args.ts +423 -0
  118. package/src/clip/assets.ts +262 -0
  119. package/src/clip/bounded-byte-buffer.ts +75 -0
  120. package/src/clip/browser-profiles.ts +372 -0
  121. package/src/clip/bundle-reader.ts +608 -0
  122. package/src/clip/capture.ts +1054 -0
  123. package/src/clip/cli.ts +181 -0
  124. package/src/clip/cookies.ts +512 -0
  125. package/src/clip/doctor.ts +1110 -0
  126. package/src/clip/extract.ts +868 -0
  127. package/src/clip/jobs.ts +959 -0
  128. package/src/clip/lib.ts +861 -0
  129. package/src/clip/media.ts +1474 -0
  130. package/src/clip/metadata-search-tool/Cargo.lock +2498 -0
  131. package/src/clip/metadata-search-tool/Cargo.toml +18 -0
  132. package/src/clip/metadata-search-tool/runner.ts +685 -0
  133. package/src/clip/metadata-search-tool/src/main.rs +389 -0
  134. package/src/clip/metadata-search.ts +687 -0
  135. package/src/clip/network-proxy.ts +627 -0
  136. package/src/clip/network.ts +950 -0
  137. package/src/clip/package-root.ts +54 -0
  138. package/src/clip/persist.ts +1472 -0
  139. package/src/clip/platforms.ts +1824 -0
  140. package/src/clip/refresh.ts +197 -0
  141. package/src/clip/structured.ts +432 -0
  142. package/src/clip/terminal.ts +197 -0
  143. package/src/clip/url-intelligence.ts +581 -0
  144. package/src/clip/url-metadata-backfill.ts +616 -0
  145. package/src/clip/url-metadata-cli.ts +251 -0
  146. package/src/clip/url-metadata.ts +1397 -0
  147. package/src/evaluation-analysis-v2.ts +1440 -0
  148. package/src/evaluation-builder.ts +2539 -0
  149. package/src/evaluation-corpus-authoring.ts +2052 -0
  150. package/src/evaluation-evidence.ts +1147 -0
  151. package/src/evaluation-execution-v2.ts +426 -0
  152. package/src/evaluation-implementation.ts +131 -0
  153. package/src/evaluation-kb-closure.ts +1430 -0
  154. package/src/evaluation-kb-runner-v2.ts +735 -0
  155. package/src/evaluation-kb-v2.ts +2567 -0
  156. package/src/evaluation-kb.ts +1018 -0
  157. package/src/evaluation-measurement-v2.ts +1462 -0
  158. package/src/evaluation-packing-v2.ts +452 -0
  159. package/src/evaluation-redaction.ts +28 -0
  160. package/src/evaluation-v2.ts +3857 -0
  161. package/src/evaluation.ts +1220 -0
  162. package/src/git.ts +1276 -0
  163. package/src/graph.ts +1487 -0
  164. package/src/index.ts +20 -0
  165. package/src/init.ts +123 -0
  166. package/src/navigation.ts +277 -0
  167. package/src/note-lock.ts +529 -0
  168. package/src/pdf/args.ts +202 -0
  169. package/src/pdf/capture.ts +298 -0
  170. package/src/pdf/cli.ts +159 -0
  171. package/src/pdf/extract.ts +303 -0
  172. package/src/pdf/layout.ts +618 -0
  173. package/src/pdf/markdown.ts +154 -0
  174. package/src/pdf/model.ts +234 -0
  175. package/src/pdf/ocr.ts +190 -0
  176. package/src/pdf/persist.ts +314 -0
  177. package/src/pdf/source.ts +135 -0
  178. package/src/pdf/tools.ts +146 -0
  179. package/src/pdf.ts +92 -0
  180. package/src/percolate.ts +877 -0
  181. package/src/portfolio-audit.ts +574 -0
  182. package/src/portfolio-identity.ts +162 -0
  183. package/src/portfolio-registry.ts +473 -0
  184. package/src/portfolio.ts +765 -0
  185. package/src/query.ts +646 -0
  186. package/src/repository-memory.ts +1150 -0
  187. package/src/sdk.ts +1452 -0
  188. package/src/search-rules.ts +712 -0
  189. package/src/search.ts +710 -0
  190. package/src/semantic-runtime.ts +1139 -0
  191. package/src/semantic.ts +2480 -0
  192. package/src/source-inbox.ts +232 -0
  193. package/src/untrusted-content.ts +401 -0
  194. package/src/url-intelligence.ts +104 -0
  195. package/src/vault.ts +636 -0
  196. package/src/workflow.ts +653 -0
  197. package/src/workflows/decision-context.ts +81 -0
  198. package/src/workflows/explain-change.ts +73 -0
  199. package/src/workflows/index.ts +3 -0
  200. package/src/workflows/plan-radar.ts +101 -0
package/DISCLOSURE ADDED
@@ -0,0 +1,43 @@
1
+ # Dual-use functionality disclosure
2
+
3
+ `@hraness/kb` is a local-first Markdown knowledge-base and source-capture tool.
4
+ Its intended use is to preserve research, plans, decisions, and sources that the
5
+ operator is authorized to read.
6
+
7
+ The package includes security-relevant capabilities that can be used for both
8
+ legitimate and harmful purposes:
9
+
10
+ - It can read cookies from a local browser profile or a user-supplied cookie
11
+ file when the operator explicitly selects that source.
12
+ - It can read an attached Chrome or Chromium tab, or use an owned browser
13
+ session, to capture public or signed-in content.
14
+ - It can make bounded network requests, follow validated redirects, download
15
+ selected assets, and query fixed metadata and archive providers.
16
+ - It can invoke bounded local browser, media, PDF, OCR, Git, Rust, and search
17
+ subprocesses when the operator requests a feature that needs them.
18
+ - It writes captured Markdown, metadata, evidence, and localized assets to a
19
+ caller-selected local vault.
20
+
21
+ Use these capabilities only for public content or content that you are entitled
22
+ and permitted to automate. Do not use this package to bypass authentication,
23
+ paywalls, CAPTCHAs, rate limits, DRM, audience controls, platform rules, or any
24
+ other access restriction. Do not use it to access another person's private
25
+ data.
26
+
27
+ Cookie-backed capture reads a selected store and keeps matching cookies in
28
+ memory, except for a short-lived mode-0600 cookie jar used by the optional
29
+ yt-dlp path. Path-backed browser profiles are copied to a temporary directory;
30
+ the source profile is not modified. Attached browser sessions retain their own
31
+ network behavior. Current-tab capture does not navigate, click, type, upload,
32
+ or submit. URL-based rendered capture can navigate and scroll within fixed
33
+ limits.
34
+
35
+ Captured pages, screenshots, cookies, source evidence, and terminal output can
36
+ contain credentials, private text, account names, or personal data. Review
37
+ every authenticated capture before committing, sharing, or processing it with
38
+ another service. The package applies path, network, resource, redaction, and
39
+ atomic-write controls, but those controls do not grant authorization or make
40
+ hostile content trustworthy.
41
+
42
+ Report suspected vulnerabilities through GitHub private vulnerability
43
+ reporting at https://github.com/hraness/kb/security/advisories/new.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Hraness contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,545 @@
1
+ <!-- hraness:kb-landing:start -->
2
+ # kb
3
+
4
+ [![skills.sh](https://skills.sh/b/hraness/kb)](https://skills.sh/hraness/kb)
5
+
6
+ a knowledge base for coding agents.
7
+
8
+ ## install
9
+
10
+ ```sh
11
+ bun add --global @hraness/kb@0.17.1
12
+ ```
13
+
14
+ ## about
15
+
16
+ Turn research, plans, and decisions into reusable context for coding agents.
17
+ Keep sources and repository context beside your code in Markdown and Git. Your
18
+ application stays independent.
19
+
20
+ Search identifiers and metadata. Find meaning locally with QMD. Follow
21
+ backlinks and typed relations. Inspect Git provenance. Search an explicitly
22
+ authorized portfolio of vaults without merging their Markdown or comparing
23
+ their local QMD scores.
24
+
25
+ Capture signed-in pages and PDFs. Use the TypeScript SDK and bounded workflows.
26
+
27
+ Markdown and Git stay authoritative. Indexes and graph views are replaceable.
28
+
29
+ ## use
30
+
31
+ ```sh
32
+ kb init kb
33
+ kb clip https://example.com/article --output articles
34
+ kb pdf ./report.pdf --output articles
35
+ kb percolate notes/topic --root .
36
+ kb context packages/parser/src/index.ts --root kb --repo .
37
+ kb list --where type=plan --scope packages/parser --root .
38
+ kb links notes/topic --root . --direction both
39
+ kb search "parser-v2" --root . --mode exact
40
+ kb portfolio search "parser-v2" --registry kb-portfolio.json \
41
+ --workspace .. --shared
42
+ kb history search packages/parser --root . --repo .. --json
43
+ ```
44
+
45
+ ## links
46
+
47
+ [github](https://github.com/hraness/kb)
48
+ <!-- hraness:kb-landing:end -->
49
+
50
+ ## A knowledge base for your coding agents
51
+
52
+ > Give coding agents durable, searchable memory beside the repository with plain Markdown, Git history, and replaceable local search.
53
+
54
+ Coding agents lose useful context when a session ends. The next agent can search the code again, but it cannot recover a source that was never saved, a decision that stayed in chat, or the relationship between two notes that nobody recorded. Repeating that work costs time and produces inconsistent answers.
55
+
56
+ Search alone cannot preserve agent memory. The system also needs a write path into inspectable files under version control: evidence can be captured, current understanding can be revised, plans can accumulate outcomes, and mandatory edit rules can move onto the instruction path. Search indexes, graph views, and embeddings used for meaning-based similarity should remain derived and replaceable.
57
+
58
+ [hraness/kb](<https://hraness.com/kb>) implements that split as repository-adjacent Markdown and Git. Exact lookup, metadata filters, local search, explicit links, and Git provenance help an agent find and inspect the files without making application code depend on the knowledge system.
59
+
60
+ ### The pattern converged across agent tools
61
+
62
+ [Devin's 2024 release history](<https://docs.devin.ai/release-notes/2024>) records Knowledge that could be recalled across future sessions and Repo Knowledge produced by scanning repositories. Its [2025 release history](<https://docs.devin.ai/release-notes/2025>) records DeepWiki in April, codebase intelligence inside Devin in May, and a DeepWiki Model Context Protocol server later that month.
63
+
64
+ In April 2026, Andrej Karpathy published an [LLM Wiki proposal](<https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f>) with immutable raw sources, an agent-maintained interlinked Markdown wiki, and an instruction schema. Its operations are ingest, query, and lint, with QMD as an optional search layer when a simple index stops being enough. These systems converged on durable agent-readable knowledge. The sequence does not establish direct lineage between them or hraness/kb.
65
+
66
+ ### Separate rules from explanations
67
+
68
+ A repository needs two kinds of memory. Rules that must govern an edit belong in a scoped `AGENTS.md` file on the path to the code. Rationale, history, examples, evidence, plans, and neighboring decisions belong in a knowledge base that an agent pulls only when the task needs them. This keeps mandatory instructions short without throwing away the context behind them.
69
+
70
+ A root guide carries repository-wide policy, and nested guides add constraints owned by a package or product. A nearby knowledge note can explain why a parser rejects a tempting shortcut, preserve the source behind the decision, and link the plan that introduced it. If the note and the applicable guide disagree, the guide controls the edit and the note needs repair.
71
+
72
+ The result has two concrete parts: scoped instruction files govern edits, while an ordinary Markdown vault stores supporting context. Application code imports neither the vault nor its search indexes:
73
+
74
+ **Repository rules beside durable knowledge**
75
+
76
+ ```text
77
+ repository/
78
+ ├── AGENTS.md # inherited root rules
79
+ ├── packages/parser/
80
+ │ ├── AGENTS.md # scoped rules and checks
81
+ │ └── src/
82
+ └── kb/
83
+ ├── articles/<slug>/ # captured evidence and assets
84
+ ├── notes/ # maintained explanations
85
+ ├── plans/ # decisions and outcomes
86
+ └── index.md # short authored front door
87
+ ```
88
+
89
+ ### Keep the implementation small and the files authoritative
90
+
91
+ hraness/kb packages the pattern as a small file contract. A useful vault can begin with Markdown, Git, `index.md`, and standard file search. Source capture, metadata queries, repository-path context, QMD, typed relationships, graph traversal, and TypeScript sessions are layers to add when the simpler setup stops answering the repository's questions. Application code need not import KB, and no hosted service or graph database owns its records.
92
+
93
+ Captured sources preserve evidence, notes hold current explanations, and plans retain decisions and outcomes. YAML frontmatter adds queryable metadata without requiring one domain schema for every vault. A code-related record may declare a few exact repository-relative `repository_scopes` so an agent can recover it from the path it is about. The declaration stays in the record instead of a central project database, which lets parallel agents update unrelated memory without sharing a generated file.
94
+
95
+ The Markdown files are authoritative. The catalog, QMD database, backlink view, path-context view, graph traversal, and bounded Git index are derived and replaceable. A vault can keep a managed catalog or an authored front door and render the complete inventory on demand. Deleting one of those views removes a way to retrieve knowledge, not the knowledge itself.
96
+
97
+ ### Route current memory from the code path
98
+
99
+ A broad semantic search over years of completed plans can rank a detailed historical record above the short explanation that owns the code today. `kb context packages/parser/src/index.ts --root kb --repo .` starts from a stronger signal: the path being changed. It returns the inherited guides that govern the edit, curated scope hubs, and bounded records whose declared scope is that path or one of its ancestors.
100
+
101
+ The records stay grouped by role. Maintained notes, proposed through blocked plans, dated market research, and generated reports form current memory. Completed, superseded, and cancelled plans remain available in a separate historical group. Every result states the declaration that matched and whether the target currently exists. A plan can therefore describe a future path, while a retired path remains honest historical evidence instead of being silently rewritten after a rename.
102
+
103
+ **Path context, exact scope filtering, and Git memory**
104
+
105
+ ```shell
106
+ kb context packages/parser/src/index.ts --root kb --repo .
107
+ kb list --root kb --scope packages/parser --where type=plan --json
108
+ kb history search packages/parser/src/index.ts --root kb --repo . --json
109
+ ```
110
+
111
+ ### Preserve evidence and plans as working records
112
+
113
+ Durable reasoning needs inspectable evidence. `kb clip` can read a public URL, saved HTML, rendered page, a page already open in an authenticated browser, or an existing exact Archive.today snapshot after the direct routes fail. Archive fallback is read-only and always partial. The [capture documentation](<https://github.com/hraness/kb/blob/main/docs/capture.md>) defines the supported routes. A capture writes readable Markdown beside localized assets and `capture.json`, whose manifest records where the material came from, how it was extracted, what was saved, and any warnings. “Complete” describes the selected page surface, not every hidden branch or future version of the site.
114
+
115
+ **Capture a web source or local PDF**
116
+
117
+ ```shell
118
+ kb clip "https://example.com/article" --output articles
119
+ kb pdf "/absolute/path/to/document.pdf" --output articles
120
+ ```
121
+
122
+ The resulting bundle is evidence, not final interpretation. A maintained note can cite several captures, record disagreement, and change when later evidence warrants it. The sources stay available for audit. This prevents an agent from silently replacing what a page said with what it now believes the page meant.
123
+
124
+ The `kb` Agent Skill routes vault planning requests to a focused durable-plan workflow. It creates a normal Markdown file under `kb/plans/` with an outcome, status, area, repository scopes, assumptions, dependencies, decisions, and verification method. The file grows during execution as agents record deviations, review findings, and reproducible evidence. Closeout adds a compact result and durable-memory disposition: each reusable conclusion links to the maintained note, guide, code contract, or runbook that now owns it, or says that no promotion was needed. Completed plans remain in Git as the history of the work. When a finding becomes a rule whose omission would make a future edit wrong, move that rule into the applicable `AGENTS.md` and retain the plan as its rationale.
125
+
126
+ ### Search and connect with bounded signals
127
+
128
+ An identifier, title, alias, path, tag, or quoted phrase should not depend on an embedding. Exact mode reads the live Markdown. The default hybrid mode combines those results with keyword and vector result orders from [QMD, a local search engine for Markdown](<https://github.com/tobi/qmd>), while keeping exact identity matches first. Graph context and Git provenance remain separate evidence, so neither silently changes the primary text rank.
129
+
130
+ **Path context, exact and hybrid search, and direct history**
131
+
132
+ ```shell
133
+ kb context packages/parser/src/index.ts --root kb --repo .
134
+ kb search "parser-v2" --root kb --mode exact
135
+ kb search "why does the parser reject this input?" --root kb \
136
+ --tag architecture --where status=active --json
137
+ kb history "notes/parser-design" --root kb --repo . --json
138
+ ```
139
+
140
+ `--mode keyword` uses QMD's local full-text index without loading an embedding model. Hybrid and semantic modes use a pinned local embedding model. KB reconciles every QMD hit with current Markdown before returning it, and applies metadata and tag filters to those live notes. Search modes remain explicit through `--mode exact`, `--mode keyword`, `--mode semantic`, and `--mode hybrid`.
141
+
142
+ Retrieval is bounded. The high-level `kb search` and `KnowledgeBaseSession.search` surfaces return at most 100 primary results and request at most 500 candidates from each QMD retrieval lane. Selective filters can discard stale or ineligible rows from that window. When those discards prevent KB from filling the requested eligible result set, KB marks the QMD lane degraded and the overall result partial instead of presenting the bounded approximation as complete. Scores are local ranking signals, not probabilities, and cannot be compared across modes.
143
+
144
+ Each note owns its outbound typed relationships in frontmatter. KB derives backlinks, inverse edges, and bounded traversal at read time, so parallel agents do not contend on one generated fact file. `kb percolate <note>` reports recurring concepts and missing-link candidates with inspectable support but writes nothing. An agent reads the cited notes before creating a reusable concept or relationship. Semantic similarity never creates an edge automatically.
145
+
146
+ Git provenance is opt-in. A search without `--history` performs no Git indexing. `--history` requests best-effort provenance, while `--require-history` rejects unavailable history or incomplete provenance for the selected notes. If one commit exceeds the 2,000-path detail limit, KB retains its identity and vault-local note associations, marks its co-change detail incomplete, and continues through later commits. Best-effort search reports that requested lane as partial.
147
+
148
+ Local attachment checks cover Markdown and Obsidian references to images, PDFs, and editable tldraw sources. They reject missing or escaping files while leaving external URLs alone. A source-inbox view separately lists recent captures that have no inbound disposition from maintained knowledge. It is an advisory, not an automatic backlink requirement: a saved source may intentionally remain a leaf.
149
+
150
+ ### Measure retrieval on a frozen corpus
151
+
152
+ The August 2, 2026 pilot froze one repository snapshot and 18 questions whose graded relevance judgments were written before the rankings were inspected. The evaluator scanned 156 Markdown records and projected 155 searchable notes into QMD after excluding the authored vault index and agent guides. Nine questions formed the development set, and nine were held out for the test. The test covered exact identity, conceptual recall, active plans, current decisions, code-path context, source evidence, historical rationale, stale-versus-current conflicts, and one no-answer case.
153
+
154
+ At a cutoff of 10 results, exact search recorded `Recall@10` of 0.833333, `MRR@10` of 0.892857, and `nDCG@10` of 0.790377. Hybrid search recorded 0.833333, 0.937500, and 0.833884, respectively. Recall measures how much of the judged relevant set appeared; mean reciprocal rank rewards an earlier first relevant result; normalized discounted cumulative gain also accounts for graded relevance and position.
155
+
156
+ Eight test questions had an answer. A 10,000-resample paired bootstrap, which repeatedly samples those same questions to estimate the stability of the difference, measured hybrid minus exact. The `Recall@10` difference was 0 with a 95% confidence interval of \[0, 0\]; the `MRR@10` difference was +0.044643 with \[0, 0.133929\]; and the `nDCG@10` difference was +0.043508 with \[-0.012752, 0.111832\]. Both retrievers returned a result for the one no-answer question instead of abstaining, so their no-answer accuracy was 0.
157
+
158
+ The same mixed-cache, single-run test recorded p95 latencies of 44.345 milliseconds for exact, 62.834 for hybrid, 821.370 for keyword, and 41,000.524 for semantic retrieval. The semantic figure includes the first in-process model load. The run used [QMD 2.5.3 at Hraness compatibility commit aa993dc](<https://github.com/hraness/qmd/commit/aa993dceb3ef8cfb71d470554ca437570f5a2b3c>) and a locally verified EmbeddingGemma 300M Q8 model on Bun 1.3.14 and Node 24.3.0 under arm64 Darwin 25.5.0, with an Apple M4 Max, 16 logical CPUs, and 128 GiB of memory. Each p95 summarizes only nine queries with mixed cold and warm state, so these are local diagnostics, not speed claims. The corpus is too small to establish that hybrid is generally superior to exact search or to compare KB with industry retrieval systems.
159
+
160
+ Search finds candidates. Similarity does not establish that a passage is current, correct, or supported by its sources. The Markdown, cited captures, explicit relationships, and requested Git history supply the material a reader must inspect.
161
+
162
+ ### Adopt the smallest useful split
163
+
164
+ Start with a short inherited `AGENTS.md` path for rules whose omission would make an edit wrong. A small knowledge base may need only Markdown, Git, an index page, and ordinary file search. Add source capture when evidence keeps disappearing. Add repository scopes when agents need to recover current memory from code paths. Add metadata or hybrid search when file search stops answering the repository's questions. Add links and graph views only when the relationships themselves help people make decisions.
165
+
166
+ Treat the knowledge base as repository-adjacent durable memory. Authored Markdown and Git are the record; catalogs, indexes, embeddings, and graph views are replaceable ways to find and inspect it. Checks can validate structure, captures can preserve a selected surface, and similarity can suggest candidates. None of those mechanisms proves that a source is trustworthy or an explanation is still true. People and agents must revise the knowledge as the repository changes.
167
+
168
+ ## Upgrade to v0.17.1
169
+
170
+ Version 0.17.1 adds the public `@hraness/kb` npm installation path without
171
+ changing the runtime API introduced in 0.17.0. Bun `1.3.14` or newer is now an
172
+ explicit package requirement. Consumers should review the package's declared
173
+ dual-use capture boundary and the lifecycle scripts used by optional browser
174
+ and native search adapters before enabling those scripts.
175
+
176
+ ## Upgrade to v0.17.0
177
+
178
+ Version 0.17 adds selected portfolio federation, stable note identities,
179
+ qualified external relations, search rules, capture inspection, and untrusted
180
+ context packing. Consumers with typed fixtures or custom capture writers should
181
+ make these migrations before upgrading:
182
+
183
+ - Capture writers now emit manifest schema v4 and must provide the stored
184
+ document `path`, exact UTF-8 `bytes`, and lowercase SHA-256 digest. The reader
185
+ can inspect schema v1-v3, but verification reports their document integrity as
186
+ unavailable instead of success.
187
+ - `DecisionContextOutput.search` has been removed. Consume the bounded untrusted
188
+ `context` projection and its `truncated` flag instead of transporting the raw
189
+ search result into an agent prompt.
190
+ - `VaultAnalysis` fixtures must include `externalAuthoredRelations`, even when
191
+ the value is an empty array. This keeps qualified authored edges distinct
192
+ from locally resolved graph edges.
193
+ - `createNote` and `kb note create` now assign `document_id` to new ordinary
194
+ notes. Preserve that ID across renames and update snapshots that intentionally
195
+ assert the generated frontmatter.
196
+
197
+ Existing Markdown is not rewritten automatically. Add IDs to maintained legacy
198
+ notes only through reviewed edits, and keep every QMD, graph, portfolio, and
199
+ audit projection disposable.
200
+
201
+ ## Install
202
+
203
+ [Bun](https://bun.sh/docs/installation) is the required runtime.
204
+
205
+ ### Tell your coding agent to install it
206
+
207
+ Copy this prompt into Codex, Claude Code, or another coding agent:
208
+
209
+ ```text
210
+ Install the `kb` Agent Skill from hraness/kb with the standard skills CLI. Use
211
+ the skill's runtime instructions to install the exact `@hraness/kb@0.17.1`
212
+ registry release only when the command is missing. Verify it with `kb doctor`
213
+ and `kb --help`, but do not initialize or modify a vault until I ask.
214
+ ```
215
+
216
+ Install the single public skill with either runner:
217
+
218
+ ```sh
219
+ npx skills add hraness/kb
220
+ bunx skills add hraness/kb
221
+ ```
222
+
223
+ Both commands discover the same `kb` skill and install it into the selected
224
+ agent runner. Skill installation is inert: it does not initialize a vault,
225
+ refresh a catalog, or edit Markdown. When invoked, the skill uses an existing
226
+ `kb` command or, when the command is missing, checks for Bun and installs the
227
+ CLI from the immutable `@hraness/kb@0.17.1` npm version.
228
+
229
+ The public skills CLI reads `skills/kb/` from the repository. The immutable
230
+ `0.17.1` npm package includes the same tree under
231
+ `node_modules/@hraness/kb/skills/kb/`, and the package check verifies that the
232
+ installed skill is byte-identical to the repository source.
233
+
234
+ Install the two global commands with Bun:
235
+
236
+ ```sh
237
+ bun add --global @hraness/kb@0.17.1
238
+ kb --help
239
+ kb-evaluation-builder --help
240
+ ```
241
+
242
+ The same registry package can be installed with npm:
243
+
244
+ ```sh
245
+ npm install --global --ignore-scripts @hraness/kb@0.17.1
246
+ kb --help
247
+ ```
248
+
249
+ Both commands are Bun executables. Bun `1.3.14` or newer must remain in `PATH`
250
+ even when npm performs the global installation. The conservative npm command
251
+ above disables dependency lifecycle scripts. Optional native search and
252
+ rendered-browser setup remain unavailable until the relevant scripts are
253
+ reviewed and enabled; run `kb doctor` to inspect the resulting capabilities.
254
+
255
+ For programmatic use, add the exact npm version to a Bun project:
256
+
257
+ ```sh
258
+ bun add --exact @hraness/kb@0.17.1
259
+ ```
260
+
261
+ The resulting dependency should remain exact:
262
+
263
+ ```json
264
+ {
265
+ "dependencies": {
266
+ "@hraness/kb": "0.17.1"
267
+ }
268
+ }
269
+ ```
270
+
271
+ Version 0.17.1 intentionally retains two public GitHub dependencies:
272
+ `@steipete/sweet-cookie` at Hraness release `v0.4.2` for the cookie-scope safety
273
+ fork, and `@tobilu/qmd` at commit
274
+ `aa993dceb3ef8cfb71d470554ca437570f5a2b3c` for store-local model behavior. A
275
+ registry installation therefore needs Git and public GitHub access while it
276
+ resolves those dependencies. They remain part of this release's supported
277
+ installation contract until equivalent registry releases are available.
278
+
279
+ ### Review lifecycle scripts before enabling optional adapters
280
+
281
+ [Bun blocks dependency lifecycle scripts](https://bun.sh/docs/pm/lifecycle)
282
+ unless the consumer trusts them. Run
283
+ `bun pm untrusted` in the consuming project and inspect the exact resolved
284
+ versions and scripts before allowing any of them. Do not use `bun pm trust
285
+ --all` for this package's dependency graph.
286
+
287
+ The pinned QMD Git dependency has a `prepare` script that installs development
288
+ hooks only when its own `.git` directory exists; the packaged runtime does not
289
+ need that script. Optional rendered capture uses `agent-browser`, whose
290
+ postinstall downloads a platform-specific executable. QMD's native semantic
291
+ and language-parser paths can report lifecycle scripts for `node-llama-cpp`,
292
+ `tree-sitter-go`, `tree-sitter-javascript`, `tree-sitter-python`, and
293
+ `tree-sitter-rust`. Trust only the packages required by the capability you have
294
+ chosen, then reinstall and run `kb doctor` to verify that capability. npm runs
295
+ dependency lifecycle scripts by default, so inspect the same packages before
296
+ omitting `--ignore-scripts` from an npm installation.
297
+
298
+ KB follows [npm's dual-use content
299
+ policy](https://docs.npmjs.com/policies/dual-use/) because it can read
300
+ explicitly selected signed-in browser state and perform bounded capture and
301
+ network operations. Read [`DISCLOSURE`](DISCLOSURE) and the [security
302
+ policy](SECURITY.md) before using authenticated capture.
303
+
304
+ Contributors can install from a checkout instead:
305
+
306
+ ```sh
307
+ git clone https://github.com/hraness/kb.git
308
+ cd kb
309
+ bun install --frozen-lockfile
310
+ bun link
311
+ kb --help
312
+ ```
313
+
314
+ HTTP and Archive.today capture work with the installed JavaScript dependencies. Rendered capture additionally needs a local Chromium-compatible browser. [yt-dlp](https://github.com/yt-dlp/yt-dlp) adds YouTube metadata, thumbnails, and transcripts; full audio or video localization is opt-in and some formats also need [FFmpeg](https://ffmpeg.org). PDF ingestion uses the open-source Poppler tools `pdfinfo` and `pdftohtml`; [Tesseract](https://github.com/tesseract-ocr/tesseract) adds local OCR for scans and screenshots. URL metadata backfill requires Rust on macOS or Linux to build the immutable, fixed-network, memory-confined `metadata-search-engine-rs` helper included in the installed package. Run `kb url-metadata tool build` once, then use `kb url-metadata backfill` from any working directory.
315
+
316
+ Structural commands and exact search read the current Markdown directly and
317
+ need no service, model, or graph database. KB pins
318
+ [QMD](https://github.com/tobi/qmd) 2.5.3 for local keyword and vector search.
319
+ `--mode keyword` uses its full-text index without an embedding model. Hybrid
320
+ and semantic search use a revision-pinned compact local EmbeddingGemma model;
321
+ the first index or vector query downloads about 300 MB. On macOS with Bun,
322
+ install extension-capable Homebrew SQLite with `brew install sqlite` before
323
+ using vector retrieval.
324
+
325
+ `kb doctor` statically checks the pinned QMD, SQLite, sqlite-vec,
326
+ node-llama-cpp, and matching native packages without importing native code or
327
+ downloading the model. Exact and keyword search remain model-free. KB also
328
+ refuses an older adjacent `.snapshot` directory that lacks its ownership
329
+ marker; inspect and remove only the explicitly named disposable directory,
330
+ then retry so KB never guesses that unrelated files are cache data.
331
+
332
+ ## Start a vault
333
+
334
+ ```sh
335
+ kb init my-kb
336
+ cd my-kb
337
+ kb clip https://example.com/article --output articles
338
+ kb refresh --root .
339
+ kb check --root .
340
+ ```
341
+
342
+ `kb init` creates an `index.md` front door plus `articles/`, `notes/`,
343
+ `plans/`, `riffs/`, and optional repository-context `scopes/` boundaries. The
344
+ generated Markdown remains ordinary Markdown: open it in Obsidian, edit it in a
345
+ text editor, search it with standard tools, and version it with Git.
346
+
347
+ When a vault lives at `kb/` inside a repository, inspect the instructions and
348
+ mapped context for a repository path from the repository root:
349
+
350
+ ```sh
351
+ kb agents identity packages/parser --json
352
+ kb context packages/parser/src/index.ts --root kb --repo .
353
+ kb agents check --root kb --repo .
354
+ ```
355
+
356
+ `kb agents identity` derives a canonical mapping without writing files.
357
+ `kb context` lists inherited `AGENTS.md` files from the repository root toward
358
+ the target, verified context hubs from the nearest scope back toward the root,
359
+ and bounded repository-scoped memory. Maintained knowledge, active plans,
360
+ dated research, reports, and terminal plans stay in separate groups. Every
361
+ record states the exact authored scope that matched and whether it exists.
362
+ Open only the useful summaries, then use `kb links`, `kb backlinks`, `kb list`,
363
+ or `kb search` to expand the question deliberately.
364
+
365
+ ## Command surface
366
+
367
+ | Command | Purpose |
368
+ | --- | --- |
369
+ | `kb init [directory]` | Create a new vault without merging into or overwriting an existing path; the default directory is `kb`. |
370
+ | `kb clip <url\|current>` | Capture a source and write an article bundle. `current` reads an attached active tab without navigating it; `kb capture <url>` is the explicit URL form. |
371
+ | `kb capture show\|verify\|diff <bundle>` | Inspect a stored capture as hostile content, verify its recorded document and optional asset hashes, or compare its exact Markdown bytes with a bounded Git ref. |
372
+ | `kb inspect <url>` | Run acquisition and extraction without writing a bundle. |
373
+ | `kb pdf <file-or-url> [--slug <slug>]` | Convert a local or public remote PDF into Markdown while retaining the original bytes, extracted images, OCR-derived text, URL provenance, and page provenance. |
374
+ | `kb refresh --root <directory>` | Rebuild a managed catalog atomically and report graph findings. An authored-catalog vault remains unchanged. |
375
+ | `kb check --root <directory>` | Verify catalog policy, graph integrity, and confined local image, PDF, and tldraw attachments without changing files. `--no-catalog` gates an edit lane without requiring the shared catalog refresh. |
376
+ | `kb catalog --root <directory>` | Render an exhaustive disposable catalog without modifying an authored or managed front door. |
377
+ | `kb graph --root <directory>` | Print the resolved contextual and typed graph, broken or ambiguous targets, orphans, and advisory mention candidates. |
378
+ | `kb backlinks <note> --root <directory>` | Show incoming contextual links and typed relationships for a note resolved by path, title, or alias. |
379
+ | `kb links <note> --root <directory>` | Traverse incoming, outgoing, or bidirectional contextual links and typed relationships with explicit depth and node limits. |
380
+ | `kb note create <id> --title <title> --root <directory>` | Atomically create one confined Markdown note; use `--type concept` for a reusable concept. |
381
+ | `kb relation add\|remove <source> <predicate> <target>` | Idempotently edit one source note's typed outbound relationship using an exact local note ID or canonical stable `kb://` URI. |
382
+ | `kb relation list <note> --root <directory>` | List a note's authored outbound and derived inbound typed relationships. |
383
+ | `kb percolate [note] --root <directory>` | Report evidence-backed recurring-concept and missing-relationship candidates without writing notes. |
384
+ | `kb list --root <directory>` | Filter typed nested frontmatter, tags, and repeated exact `--scope` declarations; sort by metadata, title, path, or graph counts. `kb notes` is an alias. |
385
+ | `kb index --root <directory>` | Build or incrementally refresh the optional local QMD embedding index. |
386
+ | `kb search <query> --root <directory>` | Combine live exact matches with local QMD keyword and vector retrieval. Use `--mode exact\|keyword\|semantic\|hybrid`, metadata, tags, exact `--scope` filters, or bounded graph context. `--rules <file>` enables reviewed aliases; add `--priority` for explicit rule-based ordering. Omitted history performs no Git work; `--history` requests best-effort provenance and `--require-history` rejects unavailable or incomplete selected-note provenance. |
387
+ | `kb portfolio search <query> --registry <file> --workspace <directory>` | Search only explicitly authorized vaults. Use `--shared` for public and organization entries or repeat `--vault owner/id` for a deliberate selection. The same `--rules <file>` and opt-in `--priority` apply within each selected vault before deterministic federation. |
388
+ | `kb portfolio audit --registry <file> --workspace <directory>` | Audit selected vault identities, authority groups, graph references, attachments, exact duplicate content, catalogs, and Git availability without repairing or electing an authority. |
389
+ | `kb history <note> --root <vault> --repo <repository>` | Return bounded direct provenance for one resolved note, including explicit oversized-commit limitations. |
390
+ | `kb history search <query-or-path> --root <vault> --repo <repository>` | Search bounded commit subjects, note paths, and co-change paths without authoring links or repository scopes. |
391
+ | `kb context <repository-path> --root <vault> --repo <repository>` | List inherited guides root to nearest, reciprocal hubs nearest to root, and grouped repository-scoped current and historical memory. Use `--kind auto\|file\|directory` to control path interpretation. |
392
+ | `kb inbox --root <vault>` | List recent captures without a maintained-note disposition. This is advisory and never creates links or fails merely because a source is a leaf. |
393
+ | `kb evaluate <manifest.json> --root <vault> --repo <repository>` | Verify an exact frozen Git/vault snapshot and run built-in exact, QMD, metadata, graph, path-context, and Git retrievers with raw evidence, latency, resource counters, metrics, and paired intervals. |
394
+ | `kb-evaluation-builder --anchor-seal\|--build --config <file> --artifact-root <directory>` | Anchor or build a frozen evaluation corpus through the installed package boundary. |
395
+ | `kb url-metadata tool build\|check` | Build or validate the pinned Rust metadata-search helper through the installed package boundary. |
396
+ | `kb url-metadata backfill --root <vault>` | Add resumable `url-metadata.json` sidecars for saved external URLs through the pinned metadata search helper and optional read-only Archive.today discovery. |
397
+ | `kb agents identity <repository-scope>` | Derive the normalized scope, canonical hub ID and path, owning guide path, and exact reciprocal marker without writing files. |
398
+ | `kb agents check --root <vault> --repo <repository>` | Validate context identities, exact scopes, reciprocal markers, real guide paths, collisions, confinement, and guide shape. Unmapped guides remain valid. |
399
+ | `kb agents audit --root <vault> --repo <repository>` | Run the same correctness gate, then report deterministic per-guide, section, inherited-chain, long-bullet, and exact-duplicate advisories. |
400
+ | `kb doctor` | Report capture capabilities and statically inspect local QMD, SQLite, sqlite-vec, node-llama-cpp, and native search prerequisites without loading a model. |
401
+ | `kb adapters` | Print the installed platform capability matrix. |
402
+
403
+ Vault commands default to the current directory and `index.md`; use `--root` and `--index` to select alternatives. Commands that report structured data accept `--json`. Run `kb --help` for the complete top-level surface and `kb clip --help` for capture, authentication, evidence, and resource-bound options.
404
+
405
+ ## Capture reference
406
+
407
+ Use the current browser tab without navigating it:
408
+
409
+ ```sh
410
+ kb clip current --browser-live --output articles
411
+ kb clip current --cdp 9222 --output articles
412
+ ```
413
+
414
+ For `--browser-live`, first enable Chrome's local debugging connection at `chrome://inspect/#remote-debugging` (Chrome 144+). If Chrome was launched with an explicit loopback debugging port, pass that numeric port to `--cdp` instead.
415
+
416
+ To open a URL with state from a path-backed Chromium profile, pass its path. The capture runs against a temporary copy, leaving the source profile unchanged. A named profile selects reusable agent-browser-managed state instead:
417
+
418
+ ```sh
419
+ kb clip https://example.com/private --browser-profile <path> --output articles
420
+ ```
421
+
422
+ Each web capture writes readable Markdown, `capture.json`, localized assets, and optional evidence under `articles/<slug>/`. Unless media is disabled, YouTube captures add the title, description, duration, channel, thumbnail, and a locally extracted transcript when available; other video surfaces retain a poster or thumbnail instead of downloading the video by default. See [Capture web content](docs/capture.md) for scopes, saved files, browser modes, media, evidence, completeness states, and limits.
423
+
424
+ Schema v4 manifests bind the exact saved Markdown path, byte count, and SHA-256
425
+ digest. `kb capture verify articles/<slug>` checks that digest without executing
426
+ the content. Add `--verify-assets` to check recorded assets. Source HTML remains
427
+ omitted unless `kb capture show` receives `--include-source-html`.
428
+
429
+ PDF capture uses the same bundle boundary:
430
+
431
+ ```sh
432
+ kb pdf "/absolute/path/to/document.pdf" --output articles
433
+ kb pdf "https://example.com/document.pdf" --output articles
434
+ ```
435
+
436
+ The bundle includes byte-identical `source.pdf`, readable Markdown, `capture.json`, and content-addressed extracted images. A reviewed second pass also retains its hash-bound `annotations.json`. See [Capture PDF documents](docs/pdf.md) for heading inference, OCR, screenshot metadata, completeness, and review.
437
+
438
+ ## Graph reference
439
+
440
+ Vault-root wikilinks such as
441
+ `[[notes/context-engineering|context engineering]]` and source-owned typed
442
+ frontmatter relationships are the graph's authored facts:
443
+
444
+ ```yaml
445
+ type: concept
446
+ document_id: durable-agent-memory
447
+ relations:
448
+ supports:
449
+ - notes/durable-agent-memory
450
+ ```
451
+
452
+ Predicates use lower-kebab-case. Local targets use exact vault-root IDs without
453
+ `.md`; cross-vault targets use canonical stable `kb://` URIs. `kb graph`, `kb backlinks`, `kb relation list`, and `kb links` derive
454
+ inverse edges and bounded paths without injecting reciprocal or inferred facts into notes.
455
+ `kb percolate` proposes reusable concepts and missing connections with explicit
456
+ support; an agent reviews the cited prose before authoring anything.
457
+
458
+ Within a portfolio, a note can target a stable cross-vault identity such as
459
+ `kb://hraness/sleepyland/sound-wellness-expansion`. The target vault must be
460
+ explicitly selected for `kb portfolio audit` to resolve it. Missing or invalid
461
+ `document_id` values remain legacy path identities and never gain a stable URI
462
+ by inference.
463
+
464
+ These focused views are rebuilt from current Markdown. KB never commits a graph
465
+ database, generated fact file, or engine entity ID. Parallel agents therefore
466
+ keep editing separate notes. Each lane can run `kb check --no-catalog`, and the
467
+ integrator runs one final `kb refresh` for the only shared generated region in
468
+ `index.md`. Use `kb graph --json` for a whole-vault structural question; when a
469
+ question recurs, prefer adding a focused command with a bounded output contract
470
+ over introducing a parallel query store.
471
+
472
+ Frontmatter retains nested objects, arrays, finite numbers with safe integer precision, booleans, strings, and nulls. `kb list --where type=plan --tag ingestion --sort metadata.updated --order desc` answers exact questions from that authored data. Unquoted `true`, `false`, `null`, and numeric filter values are typed; keep the quotes inside the argument to match a string with the same spelling, for example `kb list --where 'external_id="9007199254740993"'`. Hybrid search fuses exact and QMD result orders, then joins each match back to live metadata. Graph neighbors and Git provenance are returned as separate evidence. Similarity never becomes a link automatically.
473
+
474
+ Repository context preserves a stricter authority boundary. `AGENTS.md` remains
475
+ the always-loaded, normative home for ownership, required commands,
476
+ prohibitions, and edit gates. An optional `type: agent-context` note under
477
+ `scopes/` holds rationale, history, examples, evidence, and links for one exact
478
+ repository-relative directory. Its reciprocal
479
+ `<!-- kb:context scopes/<id> -->` marker appears before the guide headings.
480
+ A hub cannot override its guide or become the only home of a load-bearing
481
+ editing rule. Moving the scoped directory changes its identity.
482
+
483
+ Scope hubs are ordinary Markdown in the graph and optional QMD index;
484
+ `AGENTS.md` files remain excluded. This workflow reads repository and vault
485
+ files at development time. Applications do not need to import KB or couple
486
+ their runtime to the vault.
487
+
488
+ The package exports its full programmatic surface from `@hraness/kb`. Open one
489
+ read-only vault session through `@hraness/kb/sdk` to share a live Markdown scan
490
+ across exact search, metadata queries, reads, navigation, hybrid search, and Git
491
+ provenance. Compose finite parallel retrieval graphs with
492
+ `@hraness/kb/workflow`. `@hraness/kb/workflows` includes editable
493
+ `decision-context`, `explain-change`, and `plan-radar` compositions. Focused
494
+ lower-level entry points include
495
+ `@hraness/kb/search`, `@hraness/kb/git`,
496
+ `@hraness/kb/agent-context`,
497
+ `@hraness/kb/agent-guide-audit`, `@hraness/kb/attachments`,
498
+ `@hraness/kb/authoring`, `@hraness/kb/evaluation`,
499
+ `@hraness/kb/evaluation-kb`, and `@hraness/kb/evaluation-builder`. The builder
500
+ entry point owns frozen-corpus authoring, evidence compilation, implementation
501
+ commitments, seal validation, and the bounded v2 evaluation mechanics. A
502
+ consumer keeps its corpus, build configuration, repository-specific retriever
503
+ descriptors, and promotion expectations in its own repository. The installed
504
+ `kb-evaluation-builder` binary exposes the same build lifecycle without a
505
+ source checkout.
506
+ Other focused entries include
507
+ `@hraness/kb/graph`, `@hraness/kb/navigation`, `@hraness/kb/percolate`,
508
+ `@hraness/kb/portfolio`, `@hraness/kb/query`, `@hraness/kb/repository-memory`,
509
+ `@hraness/kb/search-rules`, `@hraness/kb/untrusted-content`,
510
+ `@hraness/kb/source-inbox`, and `@hraness/kb/semantic`; web-capture orchestration and
511
+ diagnostics from
512
+ `@hraness/kb/capture`; metadata search, Archive.today discovery, sidecar parsing,
513
+ and backfill composition from `@hraness/kb/url-intelligence`; PDF ingestion from `@hraness/kb/pdf`; and reusable
514
+ disposable-profile helpers from `@hraness/kb/browser-profiles`. Embedders that
515
+ need the CLI's lower-level ingestion machinery can use the explicit
516
+ capture-primitive subpaths listed in `package.json`, including
517
+ `@hraness/kb/clip/acquire`, `@hraness/kb/clip/args`, the DNS-pinned request and
518
+ connection-pool boundary at `@hraness/kb/clip/network`, and the browser proxy at
519
+ `@hraness/kb/clip/network-proxy`. Stored-bundle inspection, capture refresh
520
+ diffs, and the explicit local job ledger are available from
521
+ `@hraness/kb/clip/bundle-reader`, `@hraness/kb/clip/refresh`, and
522
+ `@hraness/kb/clip/jobs`.
523
+
524
+ ## Agent skills
525
+
526
+ The repository ships one reusable `kb` Agent Skill under `skills/kb/`. Its
527
+ intent router loads focused references only when a task needs them: querying
528
+ repository context and agent memory, capturing URLs or PDFs, writing durable
529
+ plans, promoting concepts and typed relationships, or refreshing and checking
530
+ a vault. The package smoke test keeps future tagged packages byte-identical to
531
+ that source tree.
532
+
533
+ ```sh
534
+ npx skills add hraness/kb
535
+ # or
536
+ bunx skills add hraness/kb
537
+ ```
538
+
539
+ The skill invokes the installed `kb` command without depending on a repository
540
+ checkout. Its runtime setup installs the pinned CLI only when the command is
541
+ missing, and it never initializes or mutates a vault as an installation side
542
+ effect. The repository's phase-orchestration skill remains available to local
543
+ repository agents but is marked internal, so public skill discovery omits it.
544
+
545
+ See [Design](docs/design.md), [Portfolio federation](docs/portfolio.md), [Agent workflow](docs/agent-workflow.md), [PDF capture](docs/pdf.md), and [Contributing](CONTRIBUTING.md) for the durable contracts and development gate. hraness/kb is available under the [MIT License](LICENSE).